<?php include("header.php"); ?>
<?php
  $connect = mysql_connect(DB_SERVER, DB_USER, DB_PWD);
	mysql_select_db(DB_CATALOG);

	if (isset($_GET['dep'])) {
  	$dep = $_GET['dep'];
	}

	if (isset($_GET['game_id'])) {
  	$gameId = $_GET['game_id'];
	}

	if (isset($_GET['board_nr'])) {
  	$boardNr = $_GET['board_nr'];
	}

	if ( empty($gameId) || empty($boardNr)) {
	  rejectIfError(null, "complain_game_board.php: partijnummer of bordnummer kon niet worden gevonden.");
	}

	if ( !isset($_SESSION['user']) ) {
	  rejectIfError(null, "U heeft geen toegang tot deze pagina.");
	}

  $user = $_SESSION['user'];

  $connect = mysql_connect(DB_SERVER, DB_USER, DB_PWD);
	mysql_select_db(DB_CATALOG);

	$query = sprintf("select ht.team_name as htname, vt.team_name as vtname,
    zgp.game_player_id from zt_game g
    join zt_game_player zgp on g.game_id = zgp.game_id
    join zt_team ht on ht.team_id = g.home_team
    join zt_team vt on vt.team_id = g.visit_team
    where zgp.board_nr = ".$boardNr);
  $result = mysql_query($query, $connect);
  rejectIfError($query, "complain_game_board.php: opzoeken partijgegevens is mislukt.");
  $row = mysql_fetch_assoc($result);
  $htname = $row['htname'];
  $vtname = $row['vtname'];
  $gamePlayerId = $row['game_player_id'];

?>

<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0" bgcolor="#FFFFFF">
	<tr>
		<td id="leftFiller" valign="top" height="100%" rowspan="3" bgcolor="#666666">
			<table border="0" cellpadding="0" cellspacing="0" height="100%" width="8px">
				<tr><td>&nbsp;</td></tr>
			</table>
		</td>
		<td id="header" valign="top" width="100%">
			<table border="0" width="100%" cellpadding="3" cellspacing="0" bgcolor="#10425b">
                <tr>
                    <td bgcolor="#666666" width="40%">
                        <?php include("inc_title.html"); ?>
                    </td>
                    <td bgcolor="#666666" align="right" valign="top">&nbsp;
                          <span class="headerSmall">Huidige versie PLAYER.DBF: <?=CURRENT_PLAYER_DBF?>
                        <?php
                        if (isset($user) && $user->club_id == 100) {
                        ?>
                        <br/>
                        <a class="headerSmall" href="import_player.php">laad andere versie</a>
                        <?php
                        }
                        ?>
                        </span>
                    </td>
                </tr>
            </table>
            <table align="center" border="0" width="100%" height="90%" cellpadding="0" cellspacing="0" style="border-top:#BCDD10 4px solid;">
                <tr>
                    <?php include("inc_sublinks.php"); ?> 
                </tr>
				<tr><td colspan="2" nowrap bgcolor="#BCDD10" height="4"><img src="../../assets/images/spacer.gif" alt="" height="1" width="1"></td></tr>
				<tr>
					<td>&nbsp;</td>
					<td valign="top">
						<table align="left" cellspacing="10" width="100%">
							<tr>
								<td colspan="4">
                  <span class="blackHeaderLarge">Zilveren Toren <?=CURRENT_ZT_YEAR?>
                  - Afdeling <?=$dep?> - Betwisting partij</span>
                  <br>&nbsp;<br>
                  <strong><?=$htname." - ".$vtname?></strong>
								</td>
							</tr>

						</table>
					</td>
				</tr>
				<tr>
			</table>
		</td>
	</tr>
</table>

<?php include("footer.php"); ?>